package org.thirdHero.db.domain;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;

/**
 * 表名 sys_red_package
 * @author chensanyong
 * @创建时间： 2020-02-12
 */
public class SysRedPackage {
    /**
     * 
     */
    private String id;

    /**
     * 
     */
    private LocalDateTime createDate;

    /**
     * 
     */
    private LocalDateTime modifyDate;

    /**
     * 红包金额

     */
    private BigDecimal money;

    /**
     * 起始金额
     */
    private BigDecimal limitMoney;

    /**
     * 有效起始日期
     */
    private Date effectStartDate;

    /**
     * 有效截止日期
     */
    private LocalDateTime effectEndDate;

    /**
     * 数量
     */
    private Integer numbers;

    /**
     * 是否可用
     */
    private Integer enabled;

    /**
     * 红包名称
     */
    private String name;

    /**
     * 可使用商品类别
     */
    private String categoryId;

    /**
     * 描述信息
     */
    private String desc;

    /**
     * 
     */
    private Integer deleted;

    /**
     * 1、纯红包
2、满减红包
3、对应类别红包
     */
    private Integer type;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public LocalDateTime getCreateDate() {
        return createDate;
    }

    public void setCreateDate(LocalDateTime createDate) {
        this.createDate = createDate;
    }

    public LocalDateTime getModifyDate() {
        return modifyDate;
    }

    public void setModifyDate(LocalDateTime modifyDate) {
        this.modifyDate = modifyDate;
    }

    /**
     * 红包金额

     * @return money 红包金额

     */
    public BigDecimal getMoney() {
        return money;
    }

    /**
     * 红包金额

     * @param money 红包金额

     */
    public void setMoney(BigDecimal money) {
        this.money = money;
    }

    /**
     * 起始金额
     * @return limit_money 起始金额
     */
    public BigDecimal getLimitMoney() {
        return limitMoney;
    }

    /**
     * 起始金额
     * @param limitMoney 起始金额
     */
    public void setLimitMoney(BigDecimal limitMoney) {
        this.limitMoney = limitMoney;
    }

    /**
     * 有效起始日期
     * @return effect_start_date 有效起始日期
     */
    public Date getEffectStartDate() {
        return effectStartDate;
    }

    /**
     * 有效起始日期
     * @param effectStartDate 有效起始日期
     */
    public void setEffectStartDate(Date effectStartDate) {
        this.effectStartDate = effectStartDate;
    }

    /**
     * 有效截止日期
     * @return effect_end_date 有效截止日期
     */
    public LocalDateTime getEffectEndDate() {
        return effectEndDate;
    }

    /**
     * 有效截止日期
     * @param effectEndDate 有效截止日期
     */
    public void setEffectEndDate(LocalDateTime effectEndDate) {
        this.effectEndDate = effectEndDate;
    }

    /**
     * 数量
     * @return numbers 数量
     */
    public Integer getNumbers() {
        return numbers;
    }

    /**
     * 数量
     * @param numbers 数量
     */
    public void setNumbers(Integer numbers) {
        this.numbers = numbers;
    }

    /**
     * 是否可用
     * @return enabled 是否可用
     */
    public Integer getEnabled() {
        return enabled;
    }

    /**
     * 是否可用
     * @param enabled 是否可用
     */
    public void setEnabled(Integer enabled) {
        this.enabled = enabled;
    }

    /**
     * 红包名称
     * @return name 红包名称
     */
    public String getName() {
        return name;
    }

    /**
     * 红包名称
     * @param name 红包名称
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * 可使用商品类别
     * @return category_id 可使用商品类别
     */
    public String getCategoryId() {
        return categoryId;
    }

    /**
     * 可使用商品类别
     * @param categoryId 可使用商品类别
     */
    public void setCategoryId(String categoryId) {
        this.categoryId = categoryId;
    }

    /**
     * 描述信息
     * @return desc 描述信息
     */
    public String getDesc() {
        return desc;
    }

    /**
     * 描述信息
     * @param desc 描述信息
     */
    public void setDesc(String desc) {
        this.desc = desc;
    }

    public Integer getDeleted() {
        return deleted;
    }

    public void setDeleted(Integer deleted) {
        this.deleted = deleted;
    }

    /**
     * 1、纯红包
2、满减红包
3、对应类别红包
     * @return type 1、纯红包
2、满减红包
3、对应类别红包
     */
    public Integer getType() {
        return type;
    }

    /**
     * 1、纯红包
2、满减红包
3、对应类别红包
     * @param type 1、纯红包
2、满减红包
3、对应类别红包
     */
    public void setType(Integer type) {
        this.type = type;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", createDate=").append(createDate);
        sb.append(", modifyDate=").append(modifyDate);
        sb.append(", money=").append(money);
        sb.append(", limitMoney=").append(limitMoney);
        sb.append(", effectStartDate=").append(effectStartDate);
        sb.append(", effectEndDate=").append(effectEndDate);
        sb.append(", numbers=").append(numbers);
        sb.append(", enabled=").append(enabled);
        sb.append(", name=").append(name);
        sb.append(", categoryId=").append(categoryId);
        sb.append(", desc=").append(desc);
        sb.append(", deleted=").append(deleted);
        sb.append(", type=").append(type);
        sb.append("]");
        return sb.toString();
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        SysRedPackage other = (SysRedPackage) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getCreateDate() == null ? other.getCreateDate() == null : this.getCreateDate().equals(other.getCreateDate()))
            && (this.getModifyDate() == null ? other.getModifyDate() == null : this.getModifyDate().equals(other.getModifyDate()))
            && (this.getMoney() == null ? other.getMoney() == null : this.getMoney().equals(other.getMoney()))
            && (this.getLimitMoney() == null ? other.getLimitMoney() == null : this.getLimitMoney().equals(other.getLimitMoney()))
            && (this.getEffectStartDate() == null ? other.getEffectStartDate() == null : this.getEffectStartDate().equals(other.getEffectStartDate()))
            && (this.getEffectEndDate() == null ? other.getEffectEndDate() == null : this.getEffectEndDate().equals(other.getEffectEndDate()))
            && (this.getNumbers() == null ? other.getNumbers() == null : this.getNumbers().equals(other.getNumbers()))
            && (this.getEnabled() == null ? other.getEnabled() == null : this.getEnabled().equals(other.getEnabled()))
            && (this.getName() == null ? other.getName() == null : this.getName().equals(other.getName()))
            && (this.getCategoryId() == null ? other.getCategoryId() == null : this.getCategoryId().equals(other.getCategoryId()))
            && (this.getDesc() == null ? other.getDesc() == null : this.getDesc().equals(other.getDesc()))
            && (this.getDeleted() == null ? other.getDeleted() == null : this.getDeleted().equals(other.getDeleted()))
            && (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getCreateDate() == null) ? 0 : getCreateDate().hashCode());
        result = prime * result + ((getModifyDate() == null) ? 0 : getModifyDate().hashCode());
        result = prime * result + ((getMoney() == null) ? 0 : getMoney().hashCode());
        result = prime * result + ((getLimitMoney() == null) ? 0 : getLimitMoney().hashCode());
        result = prime * result + ((getEffectStartDate() == null) ? 0 : getEffectStartDate().hashCode());
        result = prime * result + ((getEffectEndDate() == null) ? 0 : getEffectEndDate().hashCode());
        result = prime * result + ((getNumbers() == null) ? 0 : getNumbers().hashCode());
        result = prime * result + ((getEnabled() == null) ? 0 : getEnabled().hashCode());
        result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
        result = prime * result + ((getCategoryId() == null) ? 0 : getCategoryId().hashCode());
        result = prime * result + ((getDesc() == null) ? 0 : getDesc().hashCode());
        result = prime * result + ((getDeleted() == null) ? 0 : getDeleted().hashCode());
        result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
        return result;
    }

    /**
     * sys_red_package
     */
    public enum Column {
        id("id", "id", "VARCHAR", false),
        createDate("create_date", "createDate", "TIMESTAMP", false),
        modifyDate("modify_date", "modifyDate", "TIMESTAMP", false),
        money("money", "money", "DECIMAL", false),
        limitMoney("limit_money", "limitMoney", "DECIMAL", false),
        effectStartDate("effect_start_date", "effectStartDate", "TIMESTAMP", false),
        effectEndDate("effect_end_date", "effectEndDate", "TIMESTAMP", false),
        numbers("numbers", "numbers", "INTEGER", false),
        enabled("enabled", "enabled", "INTEGER", false),
        name("name", "name", "VARCHAR", true),
        categoryId("category_id", "categoryId", "VARCHAR", false),
        desc("desc", "desc", "VARCHAR", true),
        deleted("deleted", "deleted", "INTEGER", false),
        type("type", "type", "INTEGER", true);

        /**
         */
        private static final String BEGINNING_DELIMITER = "`";

        /**
         */
        private static final String ENDING_DELIMITER = "`";

        /**
         */
        private final String column;

        /**
         */
        private final boolean isColumnNameDelimited;

        /**
         */
        private final String javaProperty;

        /**
         */
        private final String jdbcType;

        public String value() {
            return this.column;
        }

        public String getValue() {
            return this.column;
        }

        public String getJavaProperty() {
            return this.javaProperty;
        }

        public String getJdbcType() {
            return this.jdbcType;
        }

        Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) {
            this.column = column;
            this.javaProperty = javaProperty;
            this.jdbcType = jdbcType;
            this.isColumnNameDelimited = isColumnNameDelimited;
        }

        public String desc() {
            return this.getEscapedColumnName() + " DESC";
        }

        public String asc() {
            return this.getEscapedColumnName() + " ASC";
        }

        public static Column[] excludes(Column ... excludes) {
            ArrayList<Column> columns = new ArrayList<>(Arrays.asList(Column.values()));
            if (excludes != null && excludes.length > 0) {
                columns.removeAll(new ArrayList<>(Arrays.asList(excludes)));
            }
            return columns.toArray(new Column[]{});
        }

        public String getEscapedColumnName() {
            if (this.isColumnNameDelimited) {
                return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString();
            } else {
                return this.column;
            }
        }

        public String getAliasedEscapedColumnName() {
            return this.getEscapedColumnName();
        }
    }
}